package com.authorization.authorizationserveronsso.config;

import com.authorization.authorizationserveronsso.utils.MD5Encrypt;
import org.springframework.security.crypto.password.PasswordEncoder;

/**
 * @author ：hyq
 * @date ：Created in 2021/4/14 15:47
 * @description：
 * @modified By：
 */
public class MyPasswordEncoder implements PasswordEncoder {

    @Override
    public boolean matches(CharSequence rawPassword, String encodedPassword) {
        return encodedPassword.equals(MD5Encrypt.encrypt((String) rawPassword));
    }

    @Override
    public String encode(CharSequence rawPassword) {
        return MD5Encrypt.encrypt((String) rawPassword);
    }
}
